package ${package.Controller}.vo.response;

/**
* @author yiming
* @description: TODO
* @date ${date}
*/
public class RespResult {
	private Integer code;
	private String message;
	private Object data;

	public RespResult(Integer code){
        this.code=code;


	}
	public RespResult(Integer code,String message,Object data){
		this.code=code;
		this.message=message;
		this.data=data;

	}
	public RespResult(Integer code,Object data){
		this.code=code;

		this.data=data;

	}
	public Integer getCode() {
		return code;
	}
	public void setCode(Integer code) {
		this.code = code;
	}
	public String getMessage() {
		return message;
	}
	public void setMessage(String message) {
		this.message = message;
	}
	public Object getData() {
		return data;
	}
	public void setData(Object data) {
		this.data = data;
	}
	@Override
	public String toString() {
		// TODO Auto-generated method stub
		return super.toString();
	}
    public static RespResult ok(){
        return new RespResult(ErrorCode.SUCCESS.getCode(),null);
    }
	public static RespResult ok(Object obj){
		return new RespResult(ErrorCode.SUCCESS.getCode(),obj);
	}
	public static RespResult ok(ErrorCode err,Object obj){
		return new RespResult(err.getCode(),err.getMessage(),obj);
	}
	public static RespResult ok(Integer code,String message,Object obj){
		return new RespResult(code,message,obj);
	}
	public static RespResult error(ErrorCode err){
		return new RespResult(err.getCode(),err.getMessage(),null);
	}
	public static RespResult error(ErrorCode err,Object obj){
		return new RespResult(err.getCode(),err.getMessage(),obj);
	}
	public static RespResult error(Integer code,String message){
		return new RespResult(code,message,null);
	}
	public static RespResult error(Integer code,String message,Object obj){
		return new RespResult(code,message,obj);
	}


}